package com.whmnx.main.ui;

import android.app.Activity;
import android.os.Bundle;
import android.os.Handler;
import android.view.WindowManager;

import androidx.annotation.Nullable;

import com.alibaba.android.arouter.launcher.ARouter;
import com.whmnx.base.constants.Constants;
import com.whmnx.base.router.RouterActivityPath;
import com.whmnx.main.R;

import me.goldze.mvvmhabit.utils.SPUtils;

/**
 *
 * @author goldze
 * @date 2017/8/17 0017
 * 冷启动
 */

public class SplashActivity extends Activity {
    @Override
        protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_splash);
        getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
        getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
        new Handler().postDelayed(new Runnable() {
            @Override
            public void run() {
                inMain();
            }
        }, 1 * 1000);
    }

    /**
     * 进入主页面
     */
    private void inMain() {
        if (SPUtils.getInstance().getBoolean(Constants.LOGIN2)){
            ARouter.getInstance().build(RouterActivityPath.Main.PAGER_MAIN).navigation();
        }else {
            ARouter.getInstance().build(RouterActivityPath.Sign.PAGER_LOGIN).navigation();
        }
        finish();
    }
}
